package com.dongdongshop.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongdongshop.mapper.TbSellerMapper;
import com.dongdongshop.operator.pojo.TbSeller;
import com.dongdongshop.operator.service.SellerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Service
@Component
public class SellerServiceImpl implements SellerService {

    @Autowired
    private TbSellerMapper sellerMapper;

    @Override
    public List<TbSeller> getSeller(String name,String nickName,Integer status) {
        List<TbSeller> tbSellers = sellerMapper.getSeller(name,nickName,status);
        return tbSellers;
    }

    @Override
    public TbSeller selectbysellerId(String username) {
        TbSeller tbSeller = sellerMapper.selectByPrimaryKey(username);
        return tbSeller;
    }

    @Override
    public void addRegister(TbSeller seller) {
        sellerMapper.insertSelective(seller);
    }

    @Override
    public TbSeller selectById(String sellerId) {
        TbSeller tbSeller = sellerMapper.selectByPrimaryKey(sellerId);
        return tbSeller;
    }

    @Override
    public void updateStatusById(String sellerId, String s) {
        TbSeller seller = new TbSeller();
        seller.setSellerId(sellerId);
        seller.setStatus(s);
        sellerMapper.updateByPrimaryKeySelective(seller);
    }
}
